<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ACE Autocompletion demo</title>
    <style type="text/css" media="screen">
        body {
            overflow: hidden;
        }

        #editor {
            position: absolute;
            margin: 0;
            top: 160px;
            bottom: 0;
            left: 0;
            right: 0;
            font-size: 24px;
        }
    </style>
</head>

<body>


    <h1>基本用法:</h1>

    <button onclick="print()" style="font-size: 24px;"> 控制台打印 print </button>

    <div id="editor">  123  </div>

    <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/ace/1.4.14/ace.js"       type="application/javascript"></script>
    <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/ace/1.4.14/theme-twilight.js"      type="application/javascript"></script>

    <script>

        var editor = ace.edit("editor");
        editor.setTheme("ace/theme/twilight");

        editor.setValue("some text  大家好 123123 =======");

        // 设置值:  editor.setValue("the new text here"); // 或 session.setValue
        // 获取值:  editor.getValue(); // 或 session.getValue

        function print() {
            console.log(editor.getValue()); // 或 session.getValue
        }
    </script>

</body>
</html>